home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc Source Code / Storage / ODCtr.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-22  |  6.3 KB  |  202 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ODCtr.cpp
  3.  
  4.     Contains:    Implementation of ODCtr
  5.  
  6.     Owned by:    Vincent Lo
  7.  
  8.     Copyright:    © 1994 - 1995 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <6>     10/8/95    TJ        Fixes Recomended by Refball
  13.          <5>      8/3/95    RR        #1257260: Collapse B classes. Remove
  14.                                     somInit methods. Don't call IsInitialized
  15.                                     or SubclassResponsibility
  16.          <4>     5/26/95    VL        1251403: Multithreading naming support.
  17.          <3>     9/23/94    VL        1184166: ContainerName is ODIText now.
  18.                                     1184272: ContainerID is now a sequence of
  19.                                     octets.
  20.          <2>      7/7/94    VL        Added SubClassResponsibility.
  21.          <1>     6/28/94    VL        first checked in
  22.  
  23.     To Do:
  24. */
  25.  
  26. #define ODContainer_Class_Source
  27. #include <ODCtr.xih>
  28.  
  29. #ifndef _ITEXT_
  30. #include <IText.h>
  31. #endif
  32.  
  33. #ifndef _BARRAY_
  34. #include <BArray.h>
  35. #endif
  36.  
  37. SOM_Scope ODStorageSystem*  SOMLINK ODContainerGetStorageSystem(ODContainer *somSelf, Environment *ev)
  38. {
  39.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  40.     ODContainerMethodDebug("ODContainer","ODContainerGetStorageSystem");
  41.  
  42.     WARN("A subclass should have overridden this method!");
  43.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  44.     return kODNULL;
  45. }
  46.  
  47. SOM_Scope ODContainerID  SOMLINK ODContainerGetID(ODContainer *somSelf, Environment *ev)
  48. {
  49.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  50.     ODContainerMethodDebug("ODContainer","ODContainerGetID");
  51.  
  52.     WARN("A subclass should have overridden this method!");
  53.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  54.     
  55.     // The following lines are used to pacify the compiler.
  56.     // They should never be executed.
  57.     ODByteArray    ba;
  58.     return ba;
  59. }
  60.  
  61. SOM_Scope ODContainerName  SOMLINK ODContainerGetName(ODContainer *somSelf, Environment *ev)
  62. {
  63.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  64.     ODContainerMethodDebug("ODContainer","ODContainerGetName");
  65.  
  66.     WARN("A subclass should have overridden this method!");
  67.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  68.  
  69.     // The following lines are used to pacify the compiler.
  70.     // They should never be executed.
  71.     ODContainerName    name;
  72.     return name;
  73. }
  74.  
  75. SOM_Scope void  SOMLINK ODContainerSetName(ODContainer *somSelf, Environment *ev,
  76.         ODContainerName* name)
  77. {
  78.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  79.     ODContainerMethodDebug("ODContainer","ODContainerSetName");
  80.  
  81.     WARN("A subclass should have overridden this method!");
  82.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  83. }
  84.  
  85. /*
  86.  *  private by convention
  87.  */
  88.  
  89. SOM_Scope ODDocument*  SOMLINK ODContainerAcquireDocument(ODContainer *somSelf, Environment *ev,
  90.         ODDocumentID id)
  91. {
  92.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  93.     ODContainerMethodDebug("ODContainer","ODContainerAcquireDocument");
  94.  
  95.     WARN("A subclass should have overridden this method!");
  96.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  97.     return kODNULL;
  98. }
  99.  
  100. SOM_Scope void  SOMLINK ODContainerInitContainer(ODContainer *somSelf, Environment *ev,
  101.         ODStorageSystem* system,
  102.         ODContainerID* id)
  103. {
  104.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  105.     ODContainerMethodDebug("ODContainer","ODContainerInitContainer");
  106.  
  107.     SOM_TRY
  108.     somSelf->InitRefCntObject(ev);
  109.     SOM_CATCH_ALL
  110.     SOM_ENDTRY
  111. }
  112.  
  113. SOM_Scope ODContainer*  SOMLINK ODContainerCreate(ODContainer *somSelf, Environment *ev)
  114. {
  115.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  116.     ODContainerMethodDebug("ODContainer","ODContainerCreate");
  117.  
  118.     WARN("A subclass should have overridden this method!");
  119.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  120.  
  121.     return somSelf;
  122. }
  123.  
  124. SOM_Scope ODContainer*  SOMLINK ODContainerOpen(ODContainer *somSelf, Environment *ev)
  125. {
  126.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  127.     ODContainerMethodDebug("ODContainer","ODContainerOpen");
  128.  
  129.     WARN("A subclass should have overridden this method!");
  130.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  131.     return somSelf;
  132. }
  133.  
  134. SOM_Scope ODContainer*  SOMLINK ODContainerClose(ODContainer *somSelf, Environment *ev)
  135. {
  136.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  137.     ODContainerMethodDebug("ODContainer","ODContainerClose");
  138.  
  139.     WARN("A subclass should have overridden this method!");
  140.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  141.     return somSelf;
  142. }
  143.  
  144. SOM_Scope ODContainer*  SOMLINK ODContainerReleaseDocument(ODContainer *somSelf, Environment *ev,
  145.         ODDocument* document)
  146. {
  147.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  148.     ODContainerMethodDebug("ODContainer","ODContainerReleaseDocument");
  149.  
  150.     WARN("A subclass should have overridden this method!");
  151.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  152.     return somSelf;
  153. }
  154.  
  155. SOM_Scope void  SOMLINK ODContainersomUninit(ODContainer *somSelf)
  156. {
  157.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  158.     ODContainerMethodDebug("ODContainer","ODContainersomUninit");
  159.  
  160.     ODContainer_parent_ODRefCntObject_somUninit(somSelf);
  161. }
  162.  
  163. SOM_Scope void  SOMLINK ODContainerAcquire(ODContainer *somSelf, Environment *ev)
  164. {
  165.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  166.     ODContainerMethodDebug("ODContainer","ODContainerAcquire");
  167.  
  168.     ODContainer_parent_ODRefCntObject_Acquire(somSelf,ev);
  169. }
  170.  
  171. SOM_Scope void  SOMLINK ODContainerRelease(ODContainer *somSelf, Environment *ev)
  172. {
  173.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  174.     ODContainerMethodDebug("ODContainer","ODContainerRelease");
  175.  
  176.     ODContainer_parent_ODRefCntObject_Release(somSelf,ev);
  177. }
  178.  
  179. SOM_Scope ODSize  SOMLINK ODContainerPurge(ODContainer *somSelf, Environment *ev,
  180.         ODSize size)
  181. {
  182.     /* ODContainerData *somThis = ODContainerGetData(somSelf); */
  183.     ODContainerMethodDebug("ODContainer","ODContainerPurge");
  184.  
  185.     // dh - Wrapped purge call in a SOM_TRY block.
  186.  
  187.     ODSize    purgeSize = 0; ODVolatile( purgeSize );
  188.     
  189.     SOM_TRY
  190.  
  191.         purgeSize = (ODContainer_parent_ODRefCntObject_Purge(somSelf,ev,size));;
  192.  
  193.     SOM_CATCH_ALL
  194.         WARN("Error %ld trying to purge in ODNameSpaceManagerPurge",ErrorCode());
  195.         SetErrorCode(kODNoError);        // dh - Eat the exception; Purge should not 
  196.                                         // propagate it because clients function
  197.                                         // fine whether memory was purged or not.
  198.     SOM_ENDTRY
  199.  
  200.     return purgeSize;
  201. }
  202.